# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html

import json

class JudgementPipeline(object):
    count = 0

    def process_item(self, item, spider):
        with open('data_example.json', 'ab+') as fd:
            dump = json.dumps(dict(item), ensure_ascii = False, indent = 4) + '\n'
            fd.write(dump)
            self.count += 1
            spider.logger.info('process_item [count=%s]' % self.count)
        return item
